@extends("admin.layout.common")
@section('content')
    <link rel="stylesheet" href="{{asset('css/finance/reject.css')}}">
    <div class="content">
        <!-- 公共结束 -->
        <table border="1">
            <tr>
                <th>分账ID</th>
                <th>分账周期</th>
                <th>分账类型</th>
                <th>分账金额</th>
                <th>拒绝理由</th>
                <th>操作</th>
            </tr>
            @foreach($res as $v)
                @if($v['music_status']==2)
                    <tr>
                        <td>{{$v['id']}}</td>
                        <td>{{$v['time']}}</td>
                        <td>音乐人分账</td>
                        <td>{{$v['music_total']}}</td>
                        <td rowspan="2">{{$v['music_reason']}}</td>
                        <td rowspan="2">
                            <button type="button" onclick=accountAgain("{{$v['time']}}",1)>重新分账</button>
                        </td>
                    </tr>
                    <tr>
                        <td>{{$v['id']}}</td>
                        <td>{{$v['time']}}</td>
                        <td>代理人分账</td>
                        <td>{{$v['agent_total']}}</td>
                    </tr>
                @endif
                @if($v['appoint_status']==2)
                    <tr>
                        <td>{{$v['id']}}</td>
                        <td>{{$v['time']}}</td>
                        <td>指定人分账</td>
                        <td>{{$v['appoint_total']}}</td>
                        <td>{{$v['appoint_reason']}}</td>
                        <td>
                            <button type="button" onclick=accountAgain("{{$v['time']}}",2)>重新分账</button>
                        </td>
                    </tr>
                @endif
            @endforeach
        </table>
    </div>
    <script src="{{URL::asset('js/finance/sub-accountStatement.js')}}"></script>
@endsection
<script>
    function accountAgain(time,type){
        $.post("{{url('admin/accountAgain')}}",{'time':time,'type':type},function(data){
            if(data.code==200){
                layer.msg('分账成功')
                location.reload()
            }
        })
    }
</script>


